﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Stock.Model.Utils
{
      /// <summary>
      /// 主键特性（在实体类的上方加这个特性，指定该类的主键名称）
      /// </summary>
      [AttributeUsage(AttributeTargets.Property)]
      public class PrimaryKeyAttribute : Attribute
      {
            public PrimaryKeyAttribute(string FieldName)
            {
                  this._FieldName = FieldName;
            }

            public PrimaryKeyAttribute()
            {

            }

            /// <summary>
            /// 字段名
            /// </summary>
            public string _FieldName { set; get; }
      }

      /// <summary>
      /// 非主键特性
      /// </summary>
      [AttributeUsage(AttributeTargets.Property)]
      public class ColumnsAttribute : Attribute
      {
            public ColumnsAttribute(string FieldName)
            {
                  this._FieldName = FieldName;
            }

            /// <summary>
            /// 字段名
            /// </summary>
            public string _FieldName { set; get; }
      }

      [AttributeUsage(AttributeTargets.Property)]
      public class NonTableAttribute : Attribute
      {
            public NonTableAttribute(bool primaryKey)
            {
                  this.Value = primaryKey;
            }
            public bool Value { get; protected set; }
            public bool autoIncrement = false;
      }


      [AttributeUsage(AttributeTargets.Property)]
      public class IdentityAttribute : Attribute
      {
            public bool IsIdentity { get; set; }
      }

      [AttributeUsage(AttributeTargets.Class)]
      public class TableNameAttribute : Attribute
      {
            public TableNameAttribute(string TableName)
            {
                  this._TableName = TableName;
            }
            public string _TableName { get; set; }
      }
}
